package com.ovstech.commons.pagination;

import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class Pagination<T> {

    private List<T> items = Collections.emptyList();

    private long totalItemCount;

    private int pageItemCount;

    private int pageIndex;

    private int pageCount;


    public Pagination() {
    }

    public Pagination(List<T> items, long total, int size, int number) {
        this.items = items;
        this.totalItemCount = total;
        this.pageItemCount = size;
        this.pageIndex = number;
        this.pageCount = (int) (this.totalItemCount - 1L) / this.pageItemCount + 1;
    }
}
